import { Controller, Get, Param, Query } from '@nestjs/common'
import { HomeService } from './home.service'
import { ApiOperation, ApiTags } from '@nestjs/swagger'

@ApiTags('首页')
@Controller('home')
export class HomeController {
  constructor(private readonly homeService: HomeService) {}

  // 查询轮播图数据
  @ApiOperation({ summary: '查询轮播图数据' })
  @Get('banner')
  queryBanners() {
    return this.homeService.queryBanners()
  }

  // 查询热门数据
  @ApiOperation({ summary: '查询热门数据' })
  @Get('recommend')
  queryRecommend() {
    return this.homeService.queryRecommend()
  }

  // 查询商品列表
  @ApiOperation({ summary: '查询商品列表' })
  @Get('goods')
  queryGoods(@Query() query) {
    return this.homeService.queryGoods(query)
  }

  // 查询商品详情
  @ApiOperation({ summary: '查询商品详情' })
  @Get('detail/:iid')
  queryGoodsDetail(@Param('iid') iid: string) {
    return this.homeService.queryGoodsDetail(iid)
  }
}
